var e = require("../component/cpsApi");

Page({
    behaviors: [ e ],
    data: {
        searchActive: "pdd",
        searchKey: "",
        channel_type: "",
        channel_type_name: "商品列表",
        options: {}
    },
    onLoad: function(e) {
        e.channel_type_name && (e.channel_type_name = decodeURIComponent(e.channel_type_name)), 
        console.log(e), this.setData({
            options: e,
            searchActive: e.status || "pdd"
        }), e.channel_type && this.setData({
            channel_type: e.channel_type
        }), e.keyword && this.setData({
            searchKey: decodeURIComponent(e.keyword)
        }), this.getCPSLogin("list");
    },
    onChange: function(e) {
        this.setData({
            searchKey: e.detail
        });
    },
    onSearch: function(e) {
        this.setData({
            page: 1,
            isLoadMore: !0,
            goodsData: [],
            searchActive: e.detail.name || this.data.searchActive
        }), this.searchCPSGood();
    },
    onReady: function() {},
    onShow: function() {},
    onHide: function() {},
    onUnload: function() {},
    onPullDownRefresh: function() {},
    onReachBottom: function() {
        this.searchCPSGood();
    },
    onShareTimeline: function() {
        var e = wx.getStorageSync("yz_uid"), t = "";
        return e && (t = e), {
            title: this.data.channel_type_name,
            query: "status=".concat(this.data.searchActive, "&channel_type=").concat(this.data.channel_type, "&channel_type_name=").concat(this.data.options.channel_type_name, "&mid=").concat(t)
        };
    },
    onShareAppMessage: function() {
        var e = wx.getStorageSync("yz_uid"), t = "";
        e && (t = e);
        var a = "/packageG/cps/cpsSearchPage/cpsSearchPage?status=".concat(this.data.searchActive);
        return this.data.channel_type && (a += "&channel_type=".concat(this.data.channel_type, "&channel_type_name=").concat(this.data.options.channel_type_name)), 
        {
            title: this.data.channel_type_name,
            path: a + "&mid=".concat(t)
        };
    }
});